﻿@using Topro.Entity.Enum;
@{
    Layout = "~/Views/Shared/_Dialog.cshtml";
}
@model List<Topro.Entity.Response.InventoryItem.InventoryItemResponse>
<section class="container-fluid m15_t">
<div class="data-wrap case">
    <div class="data-tool clearfix">
        <div class="pull-left form-inline ">

        </div>
        <div class="pull-right">
            <form class="form-inline" id="formSearch">
            </form>
        </div>
    </div>
    <div class="data-body data-scroll">
        <div class="data-view">
            <div class="data-div-view table-responsive">
                <table class="table table-hover table-striped table-bordered">
                    <thead>
                        <tr>
                            <th class="t_l">物料名称</th>
                            <th class="t_c wd75">数量</th>
                            <th class="t_l wd100">批号1</th>
                            <th class="t_l wd100">批号2</th>
                        </tr>
                    </thead>
                    <tbody>
                        @if (Model != null && Model.Any())
                        {
                            foreach (var item in (List<Topro.Entity.Response.InventoryItem.InventoryItemResponse>)Model)
                            {
                            <tr>
                                <td class="t_l">@(item.ProductName)</td>
                                <td class="t_c">@(item.Quantity)</td>
                                <td class="t_l">@(item.LotNo1)</td>
                                <td class="t_l">@(item.LotNo2)</td>
                            </tr>
                            }
                        }
                        else
                        {
                            <tr>
                                <td colspan="4" class="t_c">暂无记录</td>
                            </tr>
                        }
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
</section>
@section footerScript{
    <script type="text/javascript">

        function save() {

            var cover = Topro.UI.Mask({
                obj: $("body"),
                opacity: 0.5
            });

            var data = $("#form").serializeJSON();

            Topro.Util.Ajax({
                type: "POST",
                url: "/Inventory/Save",
                data: data,
                success: function (res) {
                    if (res.success) {
                        cover.Remove();
                        Topro.UI.DialogOpener().Tip_success("操作成功！");
                        Topro.UI.DialogOpener().In.search();
                        Topro.UI.CloseDialog();
                    } else {
                        cover.Remove();
                        Topro.UI.Tip_short_warning("操作失败！" + res.message);
                    }
                },
                error: function (json) {
                    cover.Remove();
                    Topro.UI.Tip_warning("操作失败！请查看网络，请重试。");
                }
            });

        }
    </script>
}